/*
 * EnemySprite.cs
 *
 * Created on November 18, 2007, 12:48 PM
 *
 * Copyright (C) 2007-2008  Hylke van der Schaaf
 * Copyright (C) 2010       Mathijs Miermans
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, in version 3 of the License.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */


using System.Windows.Media;
using System.Windows.Controls;
using System.Windows.Shapes;

using HexTD.util;

namespace HexTD.sprite
{
	public enum COLOR
	{
		RED,
		GREEN,
		BLUE,
		YELLOW,
		OTHER
	};

	public enum DamageType
	{
		normal,
		speed,
		power,
		time
	};

	public enum Size
	{
		small,
		normal,
		large
	};

	/*
	 * The Java enum is much more powerfull than it's C# counterpart. To emulate the
	 * behavior we use extension methods. For more info, see:
	 * http://bruceboughton.me.uk/2008/06/08/emulating-java-5-enums-in-dotnet-part-2/
	 */
	public static class SizeExtensions
	{
		public static float scaleMod(this sprite.Size s)
		{
			switch (s)
			{
				case sprite.Size.small: return 0.5f;
				case sprite.Size.normal: return 1.0f;
				case sprite.Size.large: return 1.5f;
				default:
					System.Diagnostics.Debug.WriteLine("Invalid type / letter unknown.");
					return 1.0f;
			}
		}

		public static char letter(this sprite.Size s)
		{
			switch (s)
			{
				case sprite.Size.small: return 'S';
				case sprite.Size.normal: return 'N';
				case sprite.Size.large: return 'L';
				default:
					System.Diagnostics.Debug.WriteLine("Invalid type / letter unknown.");
					return 'N';
			}
		}
	}

	public interface EnemySprite
	{

		float getPreferredDelay();

		void doTick(int gameTime);

		void resetScale();

		void paint(Canvas g2, int gameTime);

		float getX();

		float getY();

		float getPaintX();

		float getPaintY();

		bool validTarget();

		bool isDead();

		long getHealth();

		float getProgress();

		void remove();

		void doDamage(int damage, COLOR c);

		void doDamage(float damage, DamageType t, COLOR c);

		float getSpeed();

		bool isShielded();

		void setSize(Size s);

		void setSelected(bool selected);

		string getInfostring();

		string getStatusstring();

		void addStatusListener(EnemySpriteChangedListener l);

		void removeStatusListener(EnemySpriteChangedListener l);

		EnemySprite create(Context context, int path, float delay, long health, int price, Size s);
	}
}
